package states;
import globals.GlobalResources;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;


public class SlickGame extends StateBasedGame{
	
	public static final String gamename = "2D Archateture";
	public static final int height=600; 
	public static final int width=1200; 
	public static int fps=60;
	
	public GlobalResources gr;
	//State List
	public static final int menu	= 0;
	public static final int bounce	= 1;
	public static final int brick	= 2;
	public static final int blank	= 3;
	public static final int pong	= 4;
	
	
	
	//Game class Constructor
	public SlickGame(String gamename){
		super(gamename);
		this.addState(new Menu(menu)); //Each state needs to be added here and constructed
		this.addState(new Bounce(bounce)); 
		this.addState(new BrickBreaker(brick));
		this.addState(new Blank(blank));
		this.addState(new Pong(pong));
		
		gr=new GlobalResources();
	}
	
	public void initStatesList(GameContainer gc) throws SlickException{ 
		this.getState(menu).init(gc, this);//Every state also needs to be put here so it is inside the gamecontainer.
		this.getState(bounce).init(gc, this);
		this.getState(brick).init(gc, this);
		this.getState(blank).init(gc, this);
		this.getState(pong).init(gc, this);
		
		GlobalResources.init(gc, this);
		
		this.enterState(menu);//Start at this state.
	}
	
	public static void reset(){
		//GameInfo.reset();
		
	}
	
	public static void exit(GameContainer gc){ // A cleaner way of exiting.
		Menu.destroy();
		gc.exit();
	}
	
	public static void main(String[] args) {
		
		AppGameContainer appgc;//Establishes a game frame using slick commands.
		
		try{
			appgc = new AppGameContainer(new SlickGame(gamename));
			appgc.setDisplayMode(width,height,false);//Sets window size. Set to true if fullscreen wanted.
			appgc.setTargetFrameRate(fps);
			appgc.setShowFPS(true);
			appgc.start();//Starts the window.
		}catch(SlickException e){//Slick's premade exception handler
			e.printStackTrace();
		}
		
	}
}
